/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.rafkind.crawl.data;

import com.rafkind.crawl.battle.BattleCommand;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author dave
 */
public class Creature {
  private String name;
  private List<Item> inventory;
  private List<Effect> effects;
  private List<Spell> spellBook;
  private Team myTeam;
  private Team opposingTeam;
  
  private int currentInitiative;
  
  private int hitPointsMax;
  private int hitPoints;
  private int magicPointsMax;
  private int magicPoints;
  
  private int baseStrength;
  private int baseAgility;
  private int baseEndurance;  
  private int baseIntelligence;
  private int baseMagicPower;

  public Creature(String name, 
      int hitPointsMax, 
      int magicPointsMax, 
      int baseStrength, 
      int baseAgility, 
      int baseEndurance, 
      int baseIntelligence, 
      int baseMagicPower) {
    this.name = name;
    this.hitPointsMax = hitPointsMax;
    this.magicPointsMax = magicPointsMax;
    this.baseStrength = baseStrength;
    this.baseAgility = baseAgility;
    this.baseEndurance = baseEndurance;
    this.baseIntelligence = baseIntelligence;
    this.baseMagicPower = baseMagicPower;
    
    this.hitPoints = hitPointsMax;
    this.magicPoints = magicPointsMax;
    
    effects = new ArrayList<Effect>();
    inventory = new ArrayList<Item>();
    spellBook = new ArrayList<Spell>();
  }

  public String getName() {
    return name;
  }  
  
  public int getEffectiveInitiative() {
    return baseAgility;
  }

  public int getCurrentInitiative() {
    return currentInitiative;
  }

  public void setCurrentInitiative(int currentInitiative) {
    this.currentInitiative = currentInitiative;
  }

  public Team getMyTeam() {
    return myTeam;
  }

  public Team getOpposingTeam() {
    return opposingTeam;
  }

  public void setMyTeam(Team myTeam) {
    this.myTeam = myTeam;
  }

  public void setOpposingTeam(Team opposingTeam) {
    this.opposingTeam = opposingTeam;
  }
  
  public BattleCommand getBattleCommand() {
    return myTeam.getBattleCommandFor(this);
  }
  
  public boolean isActiveInBattle() {
    return hitPoints > 0;
  }
  
  public void doDamage(int howMuch) {
    hitPoints -= howMuch;
  }

  public int getHitPoints() {
    return hitPoints;
  }

  public int getMagicPoints() {
    return magicPoints;
  }

  @Override
  public String toString() {
    return name;
  }  
}